package demo1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Demo {
    public static void main(String[] args) throws Exception {
        Person p = new Person();
        p.sayHello();

        Class cls = Class.forName("demo1.Person");
        Person p2 = (Person) cls.newInstance();
        p2.sayHello();

        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("demo1");
        Person p3 = context.getBean(Person.class);
        p3.sayHello();


    }
}



























